Slider Applet

-- written by Eric C. Harshbarger while at Sun Microsystems' CDware lab.

[CAFÉ]-[CREATORS]-[APPLETS]-[FAQ]-[RESOURCES]-[RULES]-[DOWNLOADING]
Another example may be found at Eric's personal pages (since he thinks Natalie Portman is much cuter than Duke --- sorry JavaSoft [grin])
This applet constructs a 'sliding tile' puzzle based on an image you provide.

To use the applet one must download the code and place it in the same directory as the .html document in which the puzzle is to appear. NOTE: you will also need to download the following two classes which may also be found in the public ftp directory: DarkFilter.class and BrightFilter.class

Next, in the actual HTML code of the documentation the following lines should be added:

The param tags are the lines which customize the applet to your needs. Following is a list of all the parameter options which are currently applicable. Note that the 'name=' of the parameter as typed into the HTML document SHOULD BE CAPITALIZED... it is not necessary to capitalize the 'value' attributes. Defaults (where described) indicate what appropriate values will be used if not explicitly given in the HTML document.

parameters

  1. IMAGE
  2. GRID
  3. SOUND

The IMAGE parameter's value should be the name of the image you wish to place in the puzzle. The file name should include the relative directory path from the directory of the HTML document. If the image is not square, it will be cropped to the largest square which is evenly divisible by the GRID value (see next). Images may be either .gif or .jpg format.

The GRID parameter indicates the number of pieces which should be in the puzzle by assigning the number of 'tiles' in each row. For exmaple, a vlaue=4 would generate a 4x4 sliding puzzle game. It is recommended that you not use a GRID value over 4 or 5, since it will take longer for the puzzle to be generated (the Image filters tax the machine). The GRID value must be at least 2.

The SOUND parameter provides a noise which is echoed when the pieces are moved. If no value is given, no noise is made. The sound used in the example above may be used freely. It is located in the at: ftp://xm.com/pub/incoming/cafe/sounds/click.au.


Check back periodically for later editions of this applet.

-- Comments and suggestions are welcome: harshec@cdware.eng.sun.com, address Eric Harshbarger


[CAFÉ]-[CREATORS]-[APPLETS]-[FAQ]-[RESOURCES]-[RULES]-[DOWNLOADING]
The Slider applet may be used freely by anyone. Neither Sun Microsystems' nor Eric C. Harshbarger is responsible for any problems resulting from the malfunction or misuse of this applet.

© Copyright 1996, Sun Microsystems